package shiyan;

import java.util.*;


public class Six {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		Queue<Integer> List1 = new LinkedList<Integer>();
		Queue<Integer> List2 = new LinkedList<Integer>();
		Queue<Integer> out = new LinkedList<Integer>();
		int n = in.nextInt();
		for (int i = 0; i < n; i++) {
			int x = in.nextInt();
			if (x % 2 == 0) {
				List1.offer(x);
			} 
			else List2.offer(x);
		}
		while (!List1.isEmpty() || !List2.isEmpty()) {
			if(!List2.isEmpty()) System.out.print(" "+List2.poll());
			if(!List2.isEmpty()) System.out.print(" "+List2.poll());
			if(!List1.isEmpty()) System.out.print(" "+List1.poll());
		}

		}
	}


